﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;

namespace SpaceNeedle.City6473.WebSite.Security.Api
{
    public class Secure : ActionFilterAttribute
    {
        public override void OnActionExecuting(HttpActionContext filterContext)
        {

            //return filterContext.RequestContext. RedirectToAction("Login", "Users");
            /*
            Token token = null;

            try
            {
                if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["token"]))
                {
                    token = TokenManager.Parse(HttpContext.Current.Request.QueryString["token"].ToString());
                }
            }
            catch { }

            try
            {
                if (token == null)
                {
                    HttpResponseMessage msg = new HttpResponseMessage(HttpStatusCode.Forbidden);
                    msg.Content = new StringContent("Invalid Token");
                    filterContext.Response = msg;
                }
                else
                {
                    filterContext.ActionArguments["token"] = token;
                }
            }
            catch
            {
                HttpResponseMessage msg = new HttpResponseMessage(HttpStatusCode.InternalServerError);
                msg.Content = new StringContent("Token validation error");
                filterContext.Response = msg;
            }
            */
            base.OnActionExecuting(filterContext);
        }
    }  
}